<template>
  <div class="main-pay">
    <div class="box-time">
      <div class="big">{{count}}</div>
      <div class="order">正在生成支付订单</div>
      <div class="count-down">请稍后{{count}}秒后方可支付</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'pay',
  data() {
    return {
      count: 30,
      timer: null,
    }
  },
  mounted() {
    this.countDownFn();
  },
  methods: {
    countDownFn() {
      if (this.count != 0) {
        this.timer = setTimeout(() => {
          this.count--;
          this.countDownFn();
        }, 1000)
      }else {
        clearInterval(this.timer)
        console.log(111)
        window.open('alipays://platformapi/startapp?appId=20000067&url=http://114.55.0.227:8081/pay/getPayUrlByTradeNo?tradeNo=1732080212757004288');
      }
    },
  },
}

</script>

<style scoped lang="scss">
.main-pay {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  .box-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .big {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    font-size: 30px;
    font-weight: bold;
    background: #00B36B;
    color: #fff;
    text-align: center;
    line-height: 80px;
  }
  .order {
    margin-top: 30px;
    border-radius: 30px;
    padding: 6px 10px;
    background: rgb(245, 104, 111);
    color: #fff;
    font-weight: 700;
  }
  .count-down {
    margin-top: 20px;
    border-radius: 30px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, .15);
    color: rgb(245, 104, 111);
    font-weight: 700;
  }
}
</style>
